package com.acme.task1;

public class Calculator {
	public static void main(String[] args) {
		if (args.length != 3) {
			System.out.println("wrong input");
			return;
		}
		double operand1, operand2;
		
		try {
			operand1 = Double.parseDouble(args[0]);
		}
		catch (NumberFormatException err) {
			System.out.println("operand1 is wrong");
			return;
		}
		
		try {
			operand2 = Double.parseDouble(args[2]);
		}
		catch (NumberFormatException err) {
			System.out.println("operand2 is wrong");
			return;
		}
		
		
		double res=0.;
		
		switch (args[1].charAt(0)){
			case '+': 
				res = operand1 + operand2;
				break;
			case '-':
				res = operand1 - operand2;
				break;
			case '*':
				res = operand1 * operand2;
				break;
			case '/':
				if (operand2 == 0) {
					System.out.println("divide by zero");
					return;
				}
				res = operand1 / operand2;
				break;
			default :
				System.out.println("wrong operation");
		}
		
		System.out.println(operand1 + " " + args[1].charAt(0) + " " + operand2 + " = " + res);

	}
}
